package cn.gson.crm.controller;

import cn.gson.crm.model.pojos.Customer;
import cn.gson.crm.model.pojos.MoneyBackPlan;
import cn.gson.crm.model.pojos.Order;
import cn.gson.crm.model.pojos.OrderDetails;
import cn.gson.crm.model.service.MoneyBackPlanService;
import cn.gson.crm.model.service.OrderSerivice;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/MoneyBackPlanContract")
public class MoneyBackPlanController {
    @Autowired
    MoneyBackPlanService moneyBackPlanService;
    @RequestMapping("/ContractMethod")
    @ResponseBody
    //查询当前登录人下所有回款计划
    public Map<String,Object> selectmoney(HttpSession session, Integer m, Integer page, Integer size){
        return moneyBackPlanService.selectmoney(session,m,page,size);

    };
    @RequestMapping("/ContractMethod2")
    @ResponseBody
    //根据客户id查询没有被退换并且状态是发货的的订单号
    public List<Order> selectorder(Integer cid){
        return moneyBackPlanService.selectorder(cid);
    };
    @RequestMapping("/ContractMethod3")
    @ResponseBody
    //根据时间查询回款计划
    public Map<String,Object> selecttiem(HttpSession session,Integer m, String statr, String endtime,Integer page, Integer size){
        return moneyBackPlanService.selecttiem(session,m,statr,endtime,page,size);
    };
    @RequestMapping("/ContractMethod4")
    @ResponseBody
    //回款计划多条件查询
    public Map<String,Object> selectwhere(HttpSession session,Integer m,String where,Integer page, Integer size){
        return moneyBackPlanService.selectwhere(session,m,where,page,size);
    };
    @RequestMapping("/ContractMethod5")
    @ResponseBody
    //回款计划多条件查询
    public void savemoney(@RequestBody MoneyBackPlan moneyBackPlan){
        moneyBackPlanService.savemoney(moneyBackPlan);
    };
    @RequestMapping("/ContractMethod6")
    @ResponseBody
    //回款计划多条件查询
    public List<OrderDetails> selectoid(Integer oid){
     return   moneyBackPlanService.selectoid(oid);
    };
    @RequestMapping("/ContractMethod7")
    @ResponseBody
    public int selecthui(Integer oid,Integer money,Integer ordermoney){
      return moneyBackPlanService.selecthui(oid,money,ordermoney);
    };
}
